package com.bhs.sansong.ui.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bhs.sansong.R;
import com.lxj.xpopup.core.BottomPopupView;

/**
 * 底部选择弹窗
 */
public class BottomSelectDialog extends BottomPopupView implements View.OnClickListener {

    private MyClickListener listener;
    private TextView mTvSelectPicture;

    private int type = 0;

    public BottomSelectDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        TextView tvTakePicture = findViewById(R.id.tv_take_picture);
        TextView tvPhotoAlbum = findViewById(R.id.tv_photo_album);
        TextView tvCancel = findViewById(R.id.tv_cancel);
        tvTakePicture.setOnClickListener(this);
        tvPhotoAlbum.setOnClickListener(this);
        tvCancel.setOnClickListener(this);
        mTvSelectPicture = findViewById(R.id.tv_select_picture);
        mTvSelectPicture.setOnClickListener(this);
        if (type > 0) {
            mTvSelectPicture.setVisibility(VISIBLE);
        }
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_bottom_select;
    }


    public void setMyClickListener(@Nullable MyClickListener l) {
        this.listener = l;
    }

    @Override
    public void onClick(View v) {
        listener.onClick(v);
    }


    public void showSelectPicture(int type) {
        this.type = type;
    }
}
